package com.zzy.ecommerce.config;

import com.zzy.ecommerce.config.model.MyIntercepter;
import org.apache.catalina.core.ApplicationContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.servlet.ServletContext;
import java.util.List;

@Configuration
public class MyConfig implements WebMvcConfigurer {
    @Autowired
    private MyIntercepter myIntercepter;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(myIntercepter).addPathPatterns("/**")
                .excludePathPatterns("/css/**","/fonts/**","/images/**","/js/**")
                .excludePathPatterns("/","/register","/login","/adminlogin")
                .excludePathPatterns("/admin/adminaccountpage")
                .excludePathPatterns("/admin/adminacount");
    }


}
